package stage5;

public class check9 {
    public static void main(String[] args) {
        double h = 100;//开始高度
        int b = 1;//计数器
        int time = 10;
        double sum = 0;//经过路程
        double c = 0;
        //最后高度
//        for (int i = 0; i < time; i++) {
//            double fdheight = h / 2;
//            sum += h + fdheight;
//            h = fdheight;
//        }
//        System.out.println("time" + "次后返回的高度为" + h);
//        System.out.println("总高度" + sum);
        while (b<=10){
            sum +=h;
            h/=2;
            b++;
            c = h;
        }
        System.out.println("小球共经过"+sum+"米");
        System.out.println("小球最后一次高度"+c+"米");
    }

}